/*
 * $Author: isan.wong@gmail.com $
 * $Date: 2011-07-29 01:03:06 +0000 (Fri, 29 Jul 2011) $
 * $Rev: 13 $
 * $URL: http://capitalbio-smd.googlecode.com/svn/src/com/capitalbio/smd/gui/ProgressDialog.java $
 */

package com.capitalbio.smd.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.border.EmptyBorder;

public class ProgressDialog extends JDialog {
	private static final long serialVersionUID = 1L;

	private JLabel progressLabel;
	private JProgressBar progressBar;
	
	public ProgressDialog(JFrame owner) {
		super(owner, "In Progress...", true);

		progressLabel = new JLabel();
		progressLabel.setPreferredSize(new Dimension(400, 50));
		
		JPanel centerPanel = new JPanel();
		centerPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		centerPanel.add(progressLabel);
		
		getContentPane().add(centerPanel, BorderLayout.CENTER);
		
		progressBar = new JProgressBar();
		progressBar.setStringPainted(true);
		progressBar.setPreferredSize(new Dimension(400, 20));
		
		JPanel southPanel = new JPanel();
		southPanel.setBorder(new EmptyBorder(0, 5, 5, 5));
		southPanel.add(progressBar);
		
		getContentPane().add(southPanel, BorderLayout.SOUTH);
		
		pack();
		setResizable(false);
		setDefaultCloseOperation (JDialog.DO_NOTHING_ON_CLOSE) ;
		setLocationRelativeTo(owner);
	}

	public JLabel getProgressLabel() {
		return progressLabel;
	}

	public JProgressBar getProgressBar() {
		return progressBar;
	}
}